﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EventLogAssembly;
using FeatureModelCore.FMCrossTreeConstraint;
using FeatureModelCore.FMTypes;
using FeatureModelCore.FMInterface;

namespace FeatureModelCore.FeatureModelEventArgs
{
    public class ConstraintModifiedEventArgs : TreeEventArgs
    {
        #region Fields
        public bool ModifyType { get; protected set; }
        public bool ModifyNodeA { get; protected set; }
        public bool ModifyNodeB { get; protected set; }
        public FMCrossTreeConstraintType OrgType { get; protected set; }
        public FMCrossTreeConstraintType NewType { get; protected set; }
        public IFeature OrgNode { get; protected set; }
        public IFeature NewNode { get; protected set; }

        #endregion

        public ConstraintModifiedEventArgs(CrossTreeConstraint sender, string info, int infoNum
            , FMCrossTreeConstraintType orgType, FMCrossTreeConstraintType newType)
            : base(sender, info, infoNum)
        {
            this.ModifyType = true;
            this.ModifyNodeA = false;
            this.ModifyNodeB = false;

            this.OrgType = orgType;
            this.NewType = NewType;
        }

        public ConstraintModifiedEventArgs(CrossTreeConstraint sender, string info, int infoNum
            , IFeature orgNode, IFeature newNode, bool isNodeA)
            : base(sender, info, infoNum)
        {
            this.ModifyType = false;
            if (isNodeA)
            {
                this.ModifyNodeA = true;
                this.ModifyNodeB = false;
            }
            else
            {
                this.ModifyNodeA = false;
                this.ModifyNodeB = true;
            }

            this.OrgNode = orgNode;
            this.NewNode = newNode;
        }
    }
}
